In an ANDROID system, a broadcast mechanism may be used for data broadcasting between components.
Broadcast includes a system broadcast sent by the system and a broadcast customized by an application. The system broadcast, for example, may include a broadcast sent when the initiation of the system is finished, a broadcast sent when the screen is on, a broadcast sent when the screen is off, a broadcast sent when the lock screen is unlocked successfully, and so on. The sending for all above broadcasts is managed uniformly by the ANDROID system. The system puts broadcasts to be sent into a broadcast queue. As long as the queue is not empty, the broadcast messages waiting to be sent in the queue will be sent in sequence according to a first-in first-out rule.
The reception of the broadcast is based on a register manner. The system and the application both can be registered as a receiver of a certain broadcast, and one broadcast may have multiple receivers. When a certain broadcast is sent, the system sends the broadcast to all of the receivers in sequence, and after each receiver completes related operations, the system sends a next broadcast. Therefore, if there are relatively more broadcasts waiting to be sent in the broadcast queue or there are relatively more receivers of broadcast waiting to be sent in the broadcast queue, then the time from a point of sending a broadcast to a point that all the receivers receive the broadcast and complete the related processing is relatively long, causing message sending lag and poor user experience.